<?php 
include "../inc-config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Account Creation</title>
<style type="text/css">
<!--
body {
background-color: #000000;
background-image: url(../images/alliance-tile.jpg); background-repeat:repeat-x;
}
body,td,th {
color: #CC9900;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
input { background:transparent; background-image:url(../images/transpblack.png); color:#FFFFFF; border: 1px solid #333333}
select { background-color:#000000; color:#FFFFFF; border: 1px solid #333333}
textarea { background-color:#000000; color:#FFFFFF; border: 1px solid #333333}

-->
</style>
</head>
<body>
<br />
<br />
<br />
<br />
<table border='0' cellpadding="3" cellspacing="3" align="center" style="border: 1px solid #000000; background-image: url(../images/transp.png)">
<tr>
<td colspan="2" align="center"><div style=" padding: 5px; font-size:16px; background-image:url(../images/transpblack.png); border:1px solid black"><strong><?php print "$sitetitle"; ?> Account Creation</strong><br />
<span style="color:#FFFFFF; font-size:12px">This will create account for both forum and server. TBC only.</span><br />
<span style="color:#00FF00; font-size:12px">
<?php 
if(isset($_GET['ref'])&&isset($_GET['a'])) {
$ref=$_GET['ref']; 
$a=$_GET['a'];
$a2=$a{0};
$ip=$_SERVER["REMOTE_ADDR"];

//*********query ip update********
if(isset($_SESSION['user']))
{$user=$_SESSION['user'];
$getuser="SELECT * from b_users where username='$user'";
$getuser2=mysql_query($getuser) or die("Could not get user info");
$getuser3=mysql_fetch_array($getuser2);
if ($ref==$getuser3[userID]){
$getip="SELECT * from b_friends where userid='$getuser3[userID]'";
$getip2=mysql_query($getip) or die("Could not get user info");
$getip3=mysql_fetch_array($getip2);
if ($getip3[ip]<>$ip){
$upip="UPDATE b_friends SET ip='$ip' WHERE userid=$getuser3[userID]";
mysql_query($upip) or die("Could not update IP");
}
print "<font color='#ffffff'><br>This link is your link, and <strong><u>you</u></strong> can't register with it.<br><br>Give this link to friend, post on some forum<br> and upon registration gain +15 rep and +10 points.</font>";exit;} 
} else {
//***************************
$getip="SELECT * from b_friends where userid='$ref'";
$getip2=mysql_query($getip) or die("Could not get user info");
$getip3=mysql_fetch_array($getip2);
if ($ip=="$getip3[ip]") {print "<font color='#ffffff'><br>This link is your link, and <strong><u>you</u></strong> can't register with it.<br><br>Give this link to friend, post on some forum<br> and upon registration gain +15 rep and +10 points.</font>";exit;}
if ($a2=='a')      {$col="link1";}
else if ($a2=='b') {$col="link2";}
else if ($a2=='c') {$col="link3";}
else if ($a2=='d') {$col="link4";}
else if ($a2=='e') {$col="link5";}
else {print "<font color='#FF0000'>Invalid or used reffering link. Please wait...</font><META HTTP-EQUIV = 'Refresh' Content = '2; URL =register.php'>";exit;}

$getfrend="SELECT * FROM b_friends WHERE userid='$ref' AND $col='$a'";
$getfrend2=mysql_query($getfrend) or die(mysql_error());
$getfrend3=mysql_num_rows($getfrend2);
if ($getfrend3<>"0") {print "Invite bonus: +10 points";

$values="<input name='a2' type='hidden' value='$a2'/>
<input name='a' type='hidden' value='$a'/>
<input name='ref' type='hidden' value='$ref'/>";

} 
else {print "<font color='#FF0000'>Invalid or used reffering link. Please wait...</font><META HTTP-EQUIV = 'Refresh' Content = '2; URL =register.php'>";exit;}}

//$getfrend3=mysql_query($getfrend) or die ("Die");
//$getfrend4=mysql_fetch_array($getfrend3);
} else {
print "<font color='#ffffff'>Redirecting. Please wait...</font><META HTTP-EQUIV = 'Refresh' Content = '0; URL =register.php'>";exit;}

?>



</span></div></td>
</tr>
<tr class='forumrow'>
<td><form method="post" action="friendreguser.php">Username*:</td><td><input type="text" name="username" size="30"></td></tr>
<tr class='forumrow'><td>Password*:</td>
<td><?php print "$values";?><input type="password" name="password" size="30">
<br></td></tr>
<tr class='forumrow'><td>Retype password*:</td><td><input type="password" name="pass2" size="30"><br></td></tr>
<tr class='forumrow'><td>E-mail Address*:</td><td><input type="text" name="email" size="30"><br></td></tr>
<tr class='forumrow'><td>

Location:</td>
<td><input type='text' name='location' size='30'><br></td></tr>
<tr class='forumrow'>
<td>AIM:</td>
<td><input type='text' name='aim' size='30'><br></td></tr>
<tr class='forumrow'>
<td>ICQ:</td>
<td><input type='text' name='icq' size='30'><br></td></tr>
<tr class='forumrow'><td>Show Profile?</td><td><select name='showprofile'><option value='1'>Yes</option><option value='0'>No</option></select></td></tr>
<tr class='forumrow'>
<td valign='top'></td><td></td></tr>
<tr class='forumrow'><td></td><td><input type="submit" name="submit" value="  Create  " style="border:1px solid #666666; background:#000000; color: orange"></form>
</center>

</td></tr></table>

</body>
</html>